/-boot ...
boot.ts
/-docs
/-editor
/-files
/-files-old
/-imports
/-layout
/-storage
/-tests
/-tests/files
/-tests/storage
TestCase.html
TestCase.ts
TestPage.css
TestPage.html
TestPage.ts
_sampleTests.ts
teapo-tests.html
teapo-tests.ts
/-typings
TypeScriptService.ts
functions.ts
ko.ts
nteapo.html
persistence.api.ts
persistence.ts
shell.ts
teapo.html
teapo.ts
x
 
1
module teapo.app2 {
2
3
  export var completeBoot: () => void;
4
5
  export function boot() {
6
7
    var bootContainer = createElement('div', {
8
      position: 'fixed',
9
      zIndex: 1000000,
10
      left: '0px', top: '0px', right: '0px', bottom: '0px',
11
      background: 'white', color: 'black'
12
    });
13
14
    var titleDiv = createElement('div', {
15
      position: 'fixed',
16
      left: '5%', top: '5%', right: '5%',
17
      text: 'Loading...'
18
    }, bootContainer);
19
20
    document.body.appendChild(bootContainer);
21
22
    completeBoot = () => {
23
      // TODO: fade out
24
      document.body.removeChild(bootContainer);
25
    };
26
27
    addEventListener(window, 'keydown', (evt: KeyboardEvent) => {
28
      if (evt.keyCode === 83 && evt.ctrlKey) {
29
        var blob: Blob = new (<any>Blob)(['<!doctype html>\n', document.documentElement.outerHTML], { type: 'application/octet-stream' });
30
        var url = URL.createObjectURL(blob);
31
        var a = document.createElement('a');
32
        a.href = url;
33
        a.setAttribute('download', 'nteapo.html');
34
        try {
35
          // safer save method, supposed to work with FireFox
36
          var evt_ = document.createEvent("MouseEvents");
37
          (<any>evt_).initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
38
          a.dispatchEvent(evt_);
39
        }
40
        catch (e) {
41
          a.click();
42
        }
43
      }
44
    });
45
  }
46
47
48
  export function run() {
49
50
    completeBoot();
51
52
    createElement('h2', { text: 'completed!' }, document.body);
53
54
55
  }
56
57
}
37:30 local var Event dispatchEvent(evt: Event): boolean